class Solution {
    public int removeDuplicates(int[] nums) {
        int n = nums.length;
        int fast = 1;//判断
        int slow = 1; //指向新数组的下标
        while(fast < n){
            if(nums[fast] != nums[fast-1]){
                nums[slow] = nums[fast];
                slow++;
            }
            fast++;
        }
        return slow;
    }
}

